﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.ApplicationModel;

namespace CorpStore.Models
{
    /// <summary>
    /// This class represents an individual group of apps (e.g. Desktop, Utility, etc.).  Groupings are 
    /// ultimately derived from CommonCatalog.json.
    /// </summary>
    public class PackageInfoGroup
    {
        public string Name { get; set; }                        // name of Group of apps
        public string Description { get; set; }                 // descritption of this group
        public List<PackageInfo> Applications { get; set; }     // list of applications contained in this group

        public PackageInfoGroup()
        {
            Name = "";
            Description = "";
            Applications = new List<PackageInfo>();
        }

        public void AddApplication(PackageInfo app)
        {
            Applications.Add(app);
        }

        public void SortApplicationsByName()
        {
            Applications.Sort((a1, a2) => a1.DisplayName.CompareTo(a2.DisplayName));
        }

    }
}
